package cn.edu.dgut.css.sai.springsecuritygiteeexperiment;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Map;

public class GiteeUserInfoDetail implements UserDetails {

    Map<String,Object> userInfo;

    public GiteeUserInfoDetail(Map<String,Object> userInfo){
        this.userInfo = userInfo;
    }

    public Map<String,Object> getUserInfo(){
        return this.userInfo;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return null;
    }

    @Override
    public String getUsername() {
        return (String) userInfo.get("name");
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
